package cn.weiron.fun.sample.service.impl;


import cn.weiron.fun.sample.entity.SampleTimeRecord;
import cn.weiron.fun.sample.mapper.SampleTimeRecordMapper;
import cn.weiron.fun.sample.service.SampleTimeRecordService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author weiRon
 * @date 2022/9/26 15:56
 */
@Service("sampleTimeRecordServiceImpl")
public class SampleTimeRecordServiceImpl extends ServiceImpl<SampleTimeRecordMapper, SampleTimeRecord> implements SampleTimeRecordService {

    @Override
    public List<SampleTimeRecord> queryByUniqueId(String uniqueId) {
        LambdaQueryWrapper<SampleTimeRecord> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(SampleTimeRecord::getPointUniqueId,uniqueId);
        return list(wrapper);
    }

    @Override
    public SampleTimeRecord queryByUniqueIdAndTime(String uniqueId,String dateTime) {
        LambdaQueryWrapper<SampleTimeRecord> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(SampleTimeRecord::getPointUniqueId,uniqueId);
        wrapper.eq(SampleTimeRecord::getDateTime,dateTime);
        return getOne(wrapper);
    }
}
